package com.itcast.yygh.hosp.controller;

import com.itcast.common.result.R;
import com.itcast.yygh.hosp.service.DepartmentService;
import com.itcast.yygh.model.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 科室数据查询
 */
@Api("科室数据查询")
@RestController
@RequestMapping("/admin/hosp/department")
public class DepartmentController {
    @Resource
    private DepartmentService departmentService;

    //根据医院的编码查询所有的科室数据
    @ApiOperation("查询所有的科室数据")
    @GetMapping("/getDeptList/{hoscode}")
    public R getDeptList(@PathVariable("hoscode") String hoscode){
        //直接调用service中的查询方法
        List<DepartmentVo> list = departmentService.getDeptList(hoscode);
        return R.ok().data("list",list);
    }
}
